package hello.controller.fuga;

import java.util.ArrayList;
import java.util.Arrays;

import hello.service.BakaService;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class EntryController extends Controller {

    @Override
    public Navigation run() throws Exception {
        Boolean isOk = BakaService.getInstance().verifyRequestParameter(this.request, Arrays.asList("user_id", "entry_id", "destination", "title"));
        if(!isOk){
            
        }
        String userId = this.request.getParameter("user_id");
        String entryId = this.request.getParameter("entry_id");
        String destination = this.request.getParameter("destination");
        String title = this.request.getParameter("title");

        try{
            BakaService.getInstance().entry(userId, entryId, destination, title);
        }
        catch(Exception ex){
            
        }
/*        
//        String b = asString("abc");
        String b = this.request.getParameter("def");
        String a= "";
       if(this.isPost()){
           a = "postだよ";
       }else{
           a = "getだよ";
       }
       
        this.response.getWriter().print(a);
        this.response.getWriter().print(b);
        return null;
*/ 
        this.response.getWriter().print("__SUCCESS__");
        return null;
    }
}
